<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.ufida.ebscg.comm.session.UserBean" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>招商银行供应商门户-采购创造价值-供应商自助_信息修改02</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/style_add.css" rel="stylesheet" type="text/css" />
<link href="css/selfcss.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
	@import url(css/select2css.css);
-->
</style>
<script type="text/javascript" src="js/select2css.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/caltimer.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/ajaxdeal.js"></script>
</head>

<body style="width:610px">

<div id="main">
<!--右侧内容开始-->
<div id="right">
  <table width="610" border="0" cellpadding="0" cellspacing="0" background="images/self_bjc_004.jpg" height="26">
    <tr>
      <td width="10" align="center">&nbsp;</td>
      <td width="85" align="center" class="f-14-818080"><a href="modifyperson.do?to=1">基本信息</a></td>
      <td width="83" align="center" class="f-14-818080"><a href="modifyperson.do?to=1&steptype=1">联系信息</a></td>
      <td width="83" align="center" class="f-14-818080"><a href="modifyperson.do?to=1&steptype=2">其他信息</a></td>
      <td width="85" align="center" class="f-14-2b5577">多联系人</a></td>
      <td width="85" align="center" class="f-14-818080"><a href="modifyperson.do?to=1&steptype=4">文档上传</td>
      <td>&nbsp;</td>
    </tr>
  </table><br/>
<html:form action="self/modifyperson.do" method="post">
<input type="hidden" name="steptype" value="4"/>
<input type="hidden" name="zdy5" value="${message.zdy5}"/>
<div id="regright">
   <table width="610" border="0" cellpadding="0" cellspacing="0">
          <tr class="th_bj">
            <td width="105" height="28" align="center"> <span class="f-12-b-ffffff">姓名*</span></td>
            <td width="89" height="28" align="center"  ><span class="f-12-b-ffffff">手机*</span></td>
            <td width="80" height="28" align="center"  ><span class="f-12-b-ffffff">邮件*</span></td>
            <td width="80" height="28" align="center"  ><span class="f-12-b-ffffff">传真</span></td>
            <td width="100" height="28" align="center"  ><span class="f-12-b-ffffff">邮政编码</span></td>
            <td width="100" height="28" align="center"  ><span class="f-12-b-ffffff">通讯地址</span></td>
			<td align="center" width="30"><img src="../images/botton_add.jpg"  border="0" onclick="addRow()" style="cursor:hand"/>
          </tr>
   </table>   
	<table width="610" border="0" cellpadding="0" cellspacing="0" id="fileuploadtable">
	           <logic:iterate id="supagent" name="contacts">
	           <tr id="row${supagent.pk_contact_info_id }">
	            <td height="35" align="center">
	            	<input name='contact_pk_contact' type="hidden"  value="${supagent.pk_contact_info_id }"/>
	            	<input name='contact_contact_name' type='text' readonly="readonly"  style='width:80px' value="${supagent.contactname }"/>
	            </td>
	            <td align="center" ><input name='contact_phone' type='text'  style='width:80px'  value="${supagent.phone1 }" /></td>
	            <td align="center" ><input name='contact_email' type='text'  style='width:80px' value="${supagent.email }"/></td>
	            <td align="center" ><input name='contact_fax' maxlength='30' type='text'  style='width:80px' value="${supagent.fax }" /></td>
	            <td align="center" ><input name='contact_address' maxlength='6' type='text' onkeypress="return event.keyCode>=48&&event.keyCode<=57||event.keyCode==46" style='width:80px;ime-mode:Disabled;' value="${supagent.postcode}" /></td>
	            <td align="center" ><input name='contact_postaddress' type='text' style='width:100px' value="${supagent.postaddress}" /></td>
	            <td align="center"><img src='../images/botton_delete.jpg' style='cursor:hand' border=0 style='cursor:hand' onclick="deleteRow('${supagent.pk_contact_info_id}')"/></td>
	          </tr>
	          </logic:iterate>
	</table> 
  <table>
  <tr>
    <td colspan="4" class="f-12-F60000">提示：带“*”的为必填信息；若界面显示不全面，请先设置IE浏览器到兼容性视图，具体操作请见首页相关操作手册。</td>
    </tr>
  <tr>
    <tr>
      <td colspan="5" class="center"><img src="../images/botton_revision .jpg" width="60"  height="20" border="0"  onclick="toMainIndex()" style="cursor:hand"/></td>
    </tr>
  </table>
</div>
</html:form>

<script language="javascript">

	var rowindex = 0;
	//向批量上传文件的列表中添加一行数据
	function addRow() {

		var root = document.getElementById("fileuploadtable");
		var row = root.insertRow();
		row.style.height = '26px';
		rowindex++;
		row.id = "row" + rowindex;

		var cell1 = row.insertCell();
		cell1.align = "center";
		cell1.innerHTML = "<input name='contact_pk_contact' type='hidden'  value=' '/><input name='contact_contact_name' type='text'  size='13' style='width:80px'/>";

		var cell2 = row.insertCell();
		cell2.align = "center";
		cell2.innerHTML = "<input name='contact_phone' type='text'   style='width:80px' />";

		var cell4 = row.insertCell();
		cell4.align = "center";
		var innercontent = "<input name='contact_email' type='text'  style='width:80px' />";
		cell4.innerHTML = innercontent;

		var cell5 = row.insertCell();
		cell5.align = "center";
		cell5.innerHTML = "<input name='contact_fax' maxlength='30' type='text'  style='width:80px'/>";

		var cell6 = row.insertCell();
		cell6.align = "center";
		cell6.innerHTML = "<input name='contact_address' maxlength='6' type='text'   onkeypress='return event.keyCode>=48&&event.keyCode<=57||event.keyCode==46' style='width:80px;ime-mode:Disabled;' />";

		var cell7 = row.insertCell();
		cell7.align = "center";
		cell7.innerHTML = "<input name='contact_postaddress' type='text'   style='width:100px'/>";

		var cell3 = row.insertCell();
		cell3.align = "center";
		var img = "<img src='../images/botton_delete.jpg' style='cursor:hand' border=0 style='cursor:hand' onclick='deleteRow("
				+ rowindex + ")'/>";
		cell3.innerHTML = img;
	}

	//删除上传文件
	function deleteRow(index) {
		var root = document.getElementById("fileuploadtable");
		var row = "row" + index;
		var rows = root.rows;
		var deletepos = 0;

		//寻找到对应的删除行并进行删除
		for ( var pos = 0; pos < rows.length; pos++) {
			var temprow = rows[pos];
			if (temprow.id == row) {
				root.deleteRow(pos);
				deletepos = pos;
				rowindex--;
				break;
			}
		}
	}
	function isEmail(email){
		 //var myreg = /^([a-zA-Z0-9]+[_|\_|\.-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.-]?)*[a-zA-Z0-9]?\.[a-zA-Z]{2,6}$/;
		var myreg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
			if(!myreg.test(email))
		    {
		           showmess('请输入有效的E_mail！');
		           return false;
		     }else{
		     
		     	return true;
		     }
		
		}
		
	function isTel(s)
	{
		//var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?(\d){1,12})+$/;
		var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/;
		if (!patrn.exec(s)) return false
		return true
	}
			
	function toMainIndex() {
		var formtemp = document.modifyform;
		
		var contactname = document.getElementsByName("contact_contact_name");
		var contactphone = document.getElementsByName("contact_phone");
		var contactemail = document.getElementsByName("contact_email");
		
		if(contactname.length == 0){
			alert("请添加联系人！");
			return;
		}
		for(var index = 0; index < contactname.length; index++){
			if(contactname[index].value == "" || contactname[index].value.length > 20 ){
				showmess("必须填写姓名，或者你的名字超长了!");
				return;
			
			}else if(!isEmail(contactemail[index].value)){
			
				return;
			}else if(!isTel(contactphone[index].value) || contactphone[index].value.length > 16){
				showmess("请输入正确的电话号码，或者你的电话超长了!");
				return;
			}
		}
		document.modifyform.submit();
	}
</script>
</body>
</html>
